Execution Flow blocks¶
Execution Flow blocks allow to switch sections of a program during its execution among a set of pre-configured options.
Execution flow blocks are divided into 2 different types of blocks: On focus block and Switch blocks.
On focus block¶
The On Focus block outputs a boolean value, which is only True the first time the block is executed.
If used inside a Switch Block, the value will be True each time the case is selected.
On Focus can be used to trigger actions or initialize variables whenever a case is switched.
The following example would initialize User Variable 01 to 7 whenever Landing phase is selected:
Switch blocks¶
If-Else Switch block: Choose between two cases based on the state of a boolean variable.
It is possible to swap the blocks of each case (False/True) by simply right-clicking inside an if/else switch block and selecting ‘Invert’.
Integer Switch block: Choose a case based on the value of an integer variable.
Right click on the Integer switch block to access the configuration options:
Add Case: Create a new empty case.
Copy Case: Create a copy of the current case.
Delete Case: Delete the current case.
Add Entry: Add a new entry to the current case. An entry is a condition under which the case will be selected. The same entry can on only be in one case at a time. Adding an entry that already exists will move said entry to the current case.
Delete Entry: Remove an entry from the current case.
Set as Default case: The Default case will be executed whenever the switch condition does not match any of the existing entries.
Phase Switch block: Same as Integer Switch, but using Flight Phases as the switch condition.
Warning
Phase Switch and Integer Switch Blocks will report a ‘PDI ERROR’ if they don’t have at least 1 case with entries.
Use of switch blocks
Add blocks inside: Drag and drop the desired block inside the Switch block:
Input/Output: Right click inside a Switch block and select add Input/Output. To remove them, right click and select Remove Input/Output:
Note
The size of a switch block depends on the blocks it contains. A switch block will always have the size of the biggest of its existing cases.